#include <iostream>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <thread>
#include <mutex>

using namespace std;

class A
{
public:
    void doing()
    {
        mut.lock();
        for (size_t i = 0; i < 10; i++)
        {
            cout << " doing is runing id: " << this_thread::get_id() << endl;
        }
        mut.unlock();
    }
    void worke()
    {
        mut.lock();
        for (size_t i = 0; i < 10; i++)
        {
            cout << " worke is runing id: " << this_thread::get_id() << endl;
        }
        mut.unlock();
    }

private:
    mutex mut;
};

int main(int argc, char **argv)
{
    A a;
    thread job(&A::doing, &a);
    thread job2(&A::worke, &a);
    job.join();
    job2.join();

    return 0;
}